import 'dart:convert';

RechargeRecordEntity rechargeRecordEntityFromJson(String str) => RechargeRecordEntity.fromJson(json.decode(str));


class RechargeRecordEntity {
  int total;
  List<ListRechargeElement> list;
  int current;

  RechargeRecordEntity({
    required this.total,
    required this.list,
    required this.current,
  });

  factory RechargeRecordEntity.fromJson(Map<String, dynamic> json) => RechargeRecordEntity(
    total: json["total"],
    list: List<ListRechargeElement>.from(json["list"].map((x) => ListRechargeElement.fromJson(x))),
    current: json["current"],
  );

}

class ListRechargeElement {
  int? id;
  DateTime? createdAt;
  DateTime? updatedAt;
  dynamic? deletedAt;
  int? userId;
  String? amount;
  String? type;
  String? rateAmount;
  int? status;
  int? userBankId;
  List<String>? rechargeImg;
  String? rechargeType;
  int? isFirst;
  dynamic? checkNote;
  int? checkAdminId;
  Bank? bank;

  ListRechargeElement({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.deletedAt,
    required this.userId,
    required this.amount,
    required this.type,
    required this.rateAmount,
    required this.status,
    required this.userBankId,
    required this.rechargeImg,
    required this.rechargeType,
    required this.isFirst,
    required this.checkNote,
    required this.checkAdminId,
    required this.bank,
  });

  factory ListRechargeElement.fromJson(Map<String, dynamic> json) => ListRechargeElement(
    id: json["id"],
    createdAt: DateTime.parse(json["created_at"]),
    updatedAt: DateTime.parse(json["updated_at"]),
    deletedAt: json["deleted_at"],
    userId: json["user_id"],
    amount: json["amount"].toString(),
    type: json["type"],
    rateAmount: json["rate_amount"],
    status: json["status"],
    userBankId: json["user_bank_id"],
    rechargeImg: List<String>.from(json["recharge_img"].map((x) => x)),
    rechargeType: json["recharge_type"],
    isFirst: json["is_first"],
    checkNote: json["check_note"],
    checkAdminId: json["check_admin_id"],
    bank: json["bank"]==null?null:Bank.fromJson(json["bank"]),
  );


  String getStatusValue(){
    //状态 0 审核 1成功 2 驳回
    if(status==0){
      return "审核中";
    }else if(status==1){
      return "成功";
    }else if(status==2){
      return "已驳回";
    }else{
      return "";
    }
  }
}

class Bank {
  String? fullName;
  String? bankName;
  String? bankAccount;

  Bank({
    required this.fullName,
    required this.bankName,
    required this.bankAccount,
  });

  factory Bank.fromJson(Map<String, dynamic> json) => Bank(
    fullName: json["full_name"],
    bankName: json["bank_name"],
    bankAccount: json["bank_account"],
  );

  Map<String, dynamic> toJson() => {
    "full_name": fullName,
    "bank_name": bankName,
    "bank_account": bankAccount,
  };


}